package com.bw.controller;

import com.bw.bean.Sugar;
import com.bw.bean.Sugar1;
import com.bw.service.SugarService;
import com.sugar.SugarUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

@RestController
public class SugarController {
    @Autowired
    SugarService sugarService;

    @RequestMapping("/list1")
    public Map getList1(){
        List<Sugar> list=sugarService.getList1();
        return SugarUtil.getPieData(list);
    }

    @RequestMapping("/list2")
    public Map getList2(){
        Double list=sugarService.getList2();
        return SugarUtil.getFlipNumberData(list);
    }

    @RequestMapping("/list3")
    public Map getList3(){
        List<Sugar1> list=sugarService.getList3();
        List list1=new ArrayList();
        list1.add("机构");
        list1.add("完运里程");
        list1.add("完运次数");
        list1.add("完运时长");
        list1.add("每次平均时长");
        list1.add("每次平均里程");
        return SugarUtil.getTablePlayData(list1,list);
    }

    @RequestMapping("/list4")
    public Map getList4(){
        List<Sugar> list=sugarService.getList4();
        return SugarUtil.getMapData(list);
    }

    @RequestMapping("/list5")
    public Map getList5(){
        List<Sugar> list=sugarService.getList5();
        return SugarUtil.getSummaryData(list);
    }

    @RequestMapping("/list6")
    public Map getList6(){
        List<Sugar> list=sugarService.getList6();
        return SugarUtil.getPieData(list);
    }

    @RequestMapping("/list7")
    public Map getList7(){
        List<Sugar> list=sugarService.getList7();
        return SugarUtil.getBarData(list);
    }

    @RequestMapping("/list8")
    public Map getList8(){
        List<Sugar1> list=sugarService.getList8();
        List list1=new ArrayList();
        list1.add("机构");
        list1.add("完运里程");
        list1.add("完运次数");
        list1.add("完运时长");
        list1.add("每次平均时长");
        list1.add("每次平均里程");
        return SugarUtil.getTablePlayData(list1,list);
    }
}
